#include<bits/stdc++.h>
#define sd(n) scanf("%d",&n) 
#define sld(n) scanf("%lld",&n)
#define pd(n) printf("%d", (n))
#define pld(n) printf("%lld", n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
const int N = 2e5;
const int maxn = 1e6;
typedef long long int ll;
using namespace std;
//----------------------------------------------------------------------------//
int a[60];
void solve()
{
	int n, m;
	sd(n); sd(m);
	for (int i = 1; i <= n; i++)
		sd(a[i]);

	string s1;
	for (int i = 0; i <= m; i++)
	{
		s1 += 'B';
	}

	for (int i = 1; i <= n; i++)
	{
		if (a[i] <= m/ 2)
		{
			int flag = 0;
			if (s1[a[i]] == 'B')
			{
				flag = 1;
				s1[a[i]] = 'A';
			}
			if (s1[m + 1 - a[i]] == 'B' && flag == 0)
			{
				s1[m + 1 - a[i]] = 'A';
			}

		}

		else if (a[i] > m/ 2)
		{
			int flag = 0;
			if (s1[m + 1 - a[i]] == 'B' && flag == 0)
			{
				flag = 1;
				s1[m + 1 - a[i]] = 'A';
			}
			if (s1[a[i]] == 'B'&&flag==0)
			{
				flag = 1;
				s1[a[i]] = 'A';
			}

		}

	}

	for (int i = 1; i <= m; i++)
	{
		cout << s1[i];
	}
	puts("");



}

int main()
{
	int T;
	sd(T);
	while (T--)
	{
		solve();
	}
	return 0;
}